Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order for JoinSwapShareAmountOut CLI args #3942

Merged
merged 4 commits into from
Jan 9, 2023

Conversation

rrrliu
Copy link
Contributor

@rrrliu rrrliu commented Jan 7, 2023

Closes: #3813

What is the purpose of the change

Swaps the token_in_max_amount and share_out_amount CLI arguments of JoinSwapShareAmountOut to match spec in docs.

Brief Changelog

  • Swapped order of token_in_max_amount and share_out_amount in proto
  • Autogenerated resulting proto files

Testing and Verifying

Based off the example that @larry0x provided in the issue, I rebuilt osmosisd locally and ran the following to verify:

$ build/osmosisd tx gamm join-swap-share-amount-out uosmo 12345 67890 --pool-id 678 --from test1 --chain-id 1

{"body":{"messages":[{"@type":"/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut","sender":"osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks","pool_id":"678","token_in_denom":"uosmo","token_in_max_amount":"12345","share_out_amount":"67890"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"350000","payer":"","granter":""}},"signatures":[]}

confirm transaction before signing and broadcasting [y/N]: ^C  

As seen above, the token_in_max_amount being 12345 (the 2nd argument) and share_out_amount being 67890 (the 3rd argument) indicate that the order of the arguments is now fixed.

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? bugfix
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? no
  • How is the feature or change documented? gamm README

@github-actions github-actions bot added the C:x/gamm Changes, features and bugs related to the gamm module. label Jan 7, 2023
@ValarDragon ValarDragon added V:state/compatible/backport State machine compatible PR, should be backported A:backport/v13.x backport patches to v13.x branch A:backport/v14.x backport patches to v14.x branch labels Jan 7, 2023
Comment on lines 169 to 177
string token_in_max_amount = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"share_out_amount\"",
(gogoproto.moretags) = "yaml:\"token_in_max_amount\"",
(gogoproto.nullable) = false
];
string token_in_max_amount = 5 [
string share_out_amount = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"token_in_max_amount\"",
(gogoproto.moretags) = "yaml:\"share_out_amount\"",
(gogoproto.nullable) = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we can't edit the proto tx, should be editing the CLI code only.

@ValarDragon
Copy link
Member

The relevant code that should be edited is here: https://github.com/osmosis-labs/osmosis/blob/main/x/gamm/client/cli/tx.go#L137-L144

Osmocli doesn't have tooling right for now letting you change the arg order. Either we add that, or we make a custom parse fn (likely much easier) for this CLI tx. (ParseAndBuildMsg, but use osmocli methods for parsing each arg)

@larry0x
Copy link
Contributor

larry0x commented Jan 7, 2023

I think simply fixing the help text would be good enough.

Also, I suspect other CLI commands related to x/gamm may have the same issue, so better give them a test as well.

@rrrliu
Copy link
Contributor Author

rrrliu commented Jan 7, 2023

@ValarDragon thoughts on just changing the order of args on the usage text / README?

@ValarDragon
Copy link
Member

Ah yeah, just changing the help text SGTM

@github-actions github-actions bot added C:CLI C:docs Improvements or additions to documentation labels Jan 8, 2023
Copy link
Member

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TYSM! Really appreciate the issue close :)

If you get a chance, would you be down to add a changelog entry to breaking changes in the ## v13.1.2 section for

* [3647](https://github.com/osmosis-labs/osmosis/pull/3647), [3942](https://github.com/osmosis-labs/osmosis/pull/3942) (CLI) re-order the command line arguments for `osmosisd tx gamm join-swap-share-amount-out`

@rrrliu
Copy link
Contributor Author

rrrliu commented Jan 8, 2023

TYSM! Really appreciate the issue close :)

If you get a chance, would you be down to add a changelog entry to breaking changes in the ## v13.1.2 section for

* [3647](https://github.com/osmosis-labs/osmosis/pull/3647), [3942](https://github.com/osmosis-labs/osmosis/pull/3942) (CLI) re-order the command line arguments for `osmosisd tx gamm join-swap-share-amount-out`

Added!

@ValarDragon
Copy link
Member

Thank you!

@ValarDragon ValarDragon merged commit 3e26ec2 into osmosis-labs:main Jan 9, 2023
mergify bot pushed a commit that referenced this pull request Jan 9, 2023
* fix order for JoinSwapShareAmountOut args

* Revert "fix order for JoinSwapShareAmountOut args"

This reverts commit 7991c1c.

* change help text

* add line to changelog

(cherry picked from commit 3e26ec2)

# Conflicts:
#	CHANGELOG.md
mergify bot pushed a commit that referenced this pull request Jan 9, 2023
* fix order for JoinSwapShareAmountOut args

* Revert "fix order for JoinSwapShareAmountOut args"

This reverts commit 7991c1c.

* change help text

* add line to changelog

(cherry picked from commit 3e26ec2)
p0mvn pushed a commit that referenced this pull request Jan 9, 2023
* fix order for JoinSwapShareAmountOut args

* Revert "fix order for JoinSwapShareAmountOut args"

This reverts commit 7991c1c.

* change help text

* add line to changelog

(cherry picked from commit 3e26ec2)

Co-authored-by: Richard Liu <[email protected]>
ValarDragon added a commit that referenced this pull request Jan 9, 2023
* Fix order for JoinSwapShareAmountOut CLI args (#3942)

* fix order for JoinSwapShareAmountOut args

* Revert "fix order for JoinSwapShareAmountOut args"

This reverts commit 7991c1c.

* change help text

* add line to changelog

(cherry picked from commit 3e26ec2)

# Conflicts:
#	CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Richard Liu <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
@github-actions github-actions bot mentioned this pull request Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v13.x backport patches to v13.x branch A:backport/v14.x backport patches to v14.x branch C:CLI C:docs Improvements or additions to documentation C:x/gamm Changes, features and bugs related to the gamm module. V:state/compatible/backport State machine compatible PR, should be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI arguments for JoinSwapShareAmountOut are in incorrect order
3 participants